package com.app.micaihu.view.main.game.adapter;

import android.widget.ImageView;

import com.app.micaihu.R;
import com.app.micaihu.bean.game.GameCenterEntity;
import com.app.micaihu.bean.game.GameDownloadEntity;
import com.app.micaihu.configure.UmEventId;
import com.app.micaihu.custom.components.downandupload.LoadingView;
import com.app.micaihu.utils.ImageLoadUtils;
import com.app.micaihu.utils.MobclickAgentUtils;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;

import org.jetbrains.annotations.NotNull;

/**
 * 游戏下载列表适配器
 * Created by linkai on 2017/3/14.
 */
public class GameLikeDownloadAdapter extends BaseQuickAdapter<GameCenterEntity, BaseViewHolder> {

    public GameLikeDownloadAdapter() {
        super(R.layout.game_like_list_item);
    }

    @Override
    protected void convert(@NotNull BaseViewHolder baseViewHolder, GameCenterEntity gameDownloadEntity) {
        MobclickAgentUtils.event(UmEventId.game_exposed, UmEventId.INSTANCE.getGamelike());
        ImageLoadUtils.loadCornersImage(gameDownloadEntity.getIAppIcon(), ((ImageView) baseViewHolder.getView(R.id.ivHeadPic)), 5);
        baseViewHolder.setText(R.id.tvGameName, gameDownloadEntity.getITitle());
        baseViewHolder.setText(R.id.tvGameScore, gameDownloadEntity.getGradeScore());
        LoadingView loadingView = baseViewHolder.getView(R.id.game_download);
        loadingView.setTag(gameDownloadEntity);
        loadingView.setEventData(UmEventId.INSTANCE.getGamelike());

    }


}
